home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / compat / std-c.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-15  |  4.2 KB  |  168 lines  |  [TEXT/ttxt]

  1. /*
  2.  * std-c.h --
  3.  *
  4.  *    Provide emulations of standard c where parts might be lacking.
  5.  *
  6.  *    This file is adapted from tcl-7.3 tcl.h and tclInt.h and should
  7.  *    be considered a highly derivative work covered by the following
  8.  *    copyright.
  9.  *
  10.  *    Parts of this are irrelevant to mindy as it stands, but they're
  11.  *    easier to keep than to go back and dig them up later.
  12.  *
  13.  * tcl.h --
  14.  * tclInt.h --
  15.  *
  16.  * Copyright (c) 1987-1993 The Regents of the University of California.
  17.  * All rights reserved.
  18.  *
  19.  * Permission is hereby granted, without written agreement and without
  20.  * license or royalty fees, to use, copy, modify, and distribute this
  21.  * software and its documentation for any purpose, provided that the
  22.  * above copyright notice and the following two paragraphs appear in
  23.  * all copies of this software.
  24.  * 
  25.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  26.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  27.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  28.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29.  *
  30.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  31.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  32.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  33.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  34.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  35.  *
  36.  * $Header: std-c.h,v 1.2 94/11/10 20:23:57 nkramer Exp $ SPRITE (Berkeley)
  37.  * $Header: std-c.h,v 1.2 94/11/10 20:23:57 nkramer Exp $ SPRITE (Berkeley)
  38.  */
  39.  
  40. #ifndef _STD_C_H_
  41. #define _STD_C_H_
  42.  
  43. /*
  44.  * Definitions that allow this header file to be used either with or
  45.  * without ANSI C features like function prototypes.
  46.  */
  47.  
  48. #undef _ANSI_ARGS_
  49. #undef CONST
  50. #if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus)
  51. #   define _USING_PROTOTYPES_ 1
  52. #   define _ANSI_ARGS_(x)    x
  53. #   define CONST const
  54. #   ifdef __cplusplus
  55. #       define VARARGS (...)
  56. #   else
  57. #       define VARARGS ()
  58. #   endif
  59. #else
  60. #   define _ANSI_ARGS_(x)    ()
  61. #   define CONST
  62. #endif
  63.  
  64. #ifdef __cplusplus
  65. #   define EXTERN extern "C"
  66. #else
  67. #   define EXTERN extern
  68. #endif
  69.  
  70. /*
  71.  * Macro to use instead of "void" for arguments that must have
  72.  * type "void *" in ANSI C;  maps them to type "char *" in
  73.  * non-ANSI systems.
  74.  */
  75.  
  76. #ifndef VOID
  77. #   ifdef __STDC__
  78. #       define VOID void
  79. #   else
  80. #       define VOID char
  81. #   endif
  82. #endif
  83.  
  84. /*
  85.  * Miscellaneous declarations.
  86.  */
  87.  
  88. #ifndef NULL
  89. #define NULL 0
  90. #endif
  91.  
  92. /*
  93.  * Common C language include files are included here, so that
  94.  * system-dependent personalizations for the include files only
  95.  * have to be made in once place.  This results in a few extra
  96.  * includes, but greater modularity.
  97.  */
  98.  
  99. #include <stdio.h>
  100. #include <ctype.h>
  101. #ifdef NO_LIMITS_H
  102. #   include "std-limits.h"
  103. #else
  104. #   include <limits.h>
  105. #endif
  106. #ifdef NO_STDLIB_H
  107. #   include "std-stdlib.h"
  108. #else
  109. #   include <stdlib.h>
  110. #endif
  111. #ifdef NO_STRING_H
  112. #include "std-string.h"
  113. #else
  114. #include <string.h>
  115. #endif
  116. #if _USING_PROTOTYPES_
  117. #include <stdarg.h>
  118. #else
  119. #include <varargs.h>
  120. #endif
  121.  
  122. /*
  123.  * At present (12/91) not all stdlib.h implementations declare strtod.
  124.  * The declaration below is here to ensure that it's declared, so that
  125.  * the compiler won't take the default approach of assuming it returns
  126.  * an int.  There's no ANSI prototype for it because there would end
  127.  * up being too many conflicts with slightly-different prototypes.
  128.  */
  129.  
  130. extern double strtod();
  131.  
  132. /*
  133.  * hpux is claimed not to implement rint(), here's a declaration.
  134.  */
  135. extern double rint();
  136.  
  137. /*
  138.  * Provide a way to determine if there are any characters in a
  139.  * stdio buffer.  This is sure to break many more times.
  140.  */
  141. #ifdef USE_LINUX_FBUFEMPTYP
  142. #define FBUFEMPTYP(fp)        (fp->_IO_read_ptr >= fp->_IO_read_end)
  143. #else
  144. #define FBUFEMPTYP(fp)        (fp->_cnt == 0)
  145. #endif
  146.  
  147. /*
  148.  * Disappear the inline keyword when it is inappropriate.
  149.  */
  150.  
  151. #if ! __GNUC__
  152. #define inline
  153. #define __inline__
  154. #endif
  155.  
  156. /*
  157.  * Irix defines FD_ZERO() in sys/types.h using bzero(), but bzero() is
  158.  * not declared.
  159.  */
  160. #if NO_BSTRING_H
  161. #include "std-bstring.h"
  162. #else
  163. #include <bstring.h>
  164. #endif
  165.  
  166. #endif    /* _STD_C_H_ */
  167.  
  168.